package org.budo.dubbo.protocol.http.cipher;

import org.budo.dubbo.protocol.http.invocation.BudoDubboRpcInvocation;

/**
 * @author limingwei
 */
public class CipherUtil {
    public static byte[] decipher(CipherService cipherService, BudoDubboRpcInvocation budoInvocation, String value) {
        BudoDubboRpcInvocation invocation_in = new BudoDubboRpcInvocation(budoInvocation, value);
        BudoDubboRpcInvocation invocation_out = cipherService.decipher(invocation_in);

        return invocation_out.getRequestBody().getBytes();
    }

    public static byte[] cipher(CipherService cipherService, BudoDubboRpcInvocation budoInvocation, String value) {
        BudoDubboRpcInvocation invocation_in = new BudoDubboRpcInvocation(budoInvocation, value);
        BudoDubboRpcInvocation invocation_out = cipherService.cipher(invocation_in);

        return invocation_out.getRequestBody().getBytes();
    }
}